{% extends "admin/base_site.html" %}
{% load i18n admin_urls static admin_list %}

{% block extrastyle %}
  {{ block.super }}
  {% if cl.formset %}
  {% endif %}
  {% if cl.formset or action_form %}
    <script type="text/javascript" src="{% url 'admin:jsi18n' %}"></script>
  {% endif %}
  {{ media.css }}
  {% if not actions_on_top and not actions_on_bottom %}
    <style>
      #changelist table thead th:first-child {width: inherit}
    </style>
  {% endif %}
{% endblock %}

{% block extrahead %}
{{ block.super }}
{{ media.js }}
{% endblock %}

{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} change-list{% endblock %}

{% if not is_popup %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
&rsaquo; <a href="{% url 'admin:app_list' app_label=cl.opts.app_label %}">{{ cl.opts.app_config.verbose_name }}</a>
&rsaquo; {{ cl.opts.verbose_name_plural|capfirst }}
</div>
{% endblock %}
{% endif %}

{% block coltype %}flex{% endblock %}

{% block content %}
  <div id="content-main">
  
	{% if cl.has_filters or cl.search_fields %}
		<div class="row">
			<div class="col-xs-12">
				<div class="box">
					<div class="box-header">
						{% trans 'Filter and Search' %}
					</div>
					<div class="box-body">
						{% block search %}{% search_form cl %}{% endblock %}
						{% block date_hierarchy %}{% date_hierarchy cl %}{% endblock %}

						  {% block filters %}
							{% if cl.has_filters %}
							  
								{% for spec in cl.filter_specs %}
									<div class="col-md-2">
										{% admin_list_filter cl spec %}
									</div>
								{% endfor %}
							  
							{% endif %}
						{% endblock %}
					 </div>
					 
				</div>
			</div>
		</div>
	{% endif %}
	<div class="row">
		<div class="col-xs-12">
			<div class="box">
				<div class="box-header">
				<h3 class="box-title">{% blocktrans with cl.opts.verbose_name_plural as pname %} {{ pname }}{% endblocktrans %}</h3>
					<div class="box-tools">
						<div class="input-group input-group-sm">
							{% block object-tools %}
								
								  {% block object-tools-items %}
									{% if has_add_permission %}
									
									  {% url cl.opts|admin_urlname:'add' as add_url %}
									  
									  <a href="{% add_preserved_filters add_url is_popup to_field %}" class="btn btn-block btn-primary">
										{% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}
									  </a>
									
									{% endif %}
								  {% endblock %}
								  
								
							{% endblock %}
							
						</div>
					</div>
				</div>
				<div class="box-body table-responsive no-padding">
					{% if cl.formset.errors %}
						<p class="errornote">
						{% if cl.formset.total_error_count == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %}
						</p>
						{{ cl.formset.non_form_errors }}
					{% endif %}
					<div id="changelist">
					  

					  <form id="changelist-form" method="post"{% if cl.formset.is_multipart %} enctype="multipart/form-data"{% endif %} novalidate>{% csrf_token %}
					  {% if cl.formset %}
						<div>{{ cl.formset.management_form }}</div>
					  {% endif %}

					  {% block result_list %}
						
						  {% result_list cl %}
						  
					  {% endblock %}
					  
					 
					</div>
				</div>
				<div class="box-footer clearfix">
					<div class="pagination pagination-sm no-margin pull-right"> 
						{% block pagination %}{% pagination cl %}{% endblock %}
					</div>
					{% if action_form and actions_on_bottom and cl.show_admin_actions %}{% admin_actions %}{% endif %}
					{% if action_form and actions_on_top and cl.show_admin_actions %}{% admin_actions %}{% endif %}
				</div>
				</form>
			</div>	
		</div>
	</div>
  </div>
{% endblock %}